<template>
	<view class="contract-base-info">
		<!-- 姓名 -->
		<view class="username cell-item">
			<view>合同标题</view>
			<view class="right-content">{{contractEntity.contractTitle||'--'}}</view>
		</view>
		<!-- 邮箱 -->
		<view class="email cell-item">
			<view>合同价格</view>
			<view class="right-content">{{contractEntity.contractPrice==null?'--':'￥'+contractEntity.contractPrice}}</view>
		</view>
		<!-- 手机号 -->
		<view class="telPhone cell-item">
			<view>合同编号</view>
			<view class="right-content">{{contractEntity.contractNumber||'--'}}</view>
		</view>
		<view class="role cell-item">
			<view>{{type==1?'销售负责人':'采购负责人'}}</view>
			<view class="right-content">{{contractEntity.userName||'--'}}</view>
		</view>
		<view class="role cell-item">
			<view>申请人</view>
			<view class="right-content">{{contractEntity.applyUserName||'--'}}</view>
		</view>
		<view class="role cell-item">
			<view>审批人</view>
			<view class="right-content">{{contractEntity.nextApproveUserName||'--'}}</view>
		</view>
		<!-- 商家名称 -->
		<view class="regitster-info cell-item">
			<view>签署日期</view>
			<view class="right-content"><uni-dateformat v-if='contractEntity.signedTime':date="contractEntity.signedTime"
					format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<!-- 商家地区 -->
		<view class="regitster-info cell-item">
			<view>交货日期</view>
			<view class="right-content"><uni-dateformat v-if='contractEntity.deliveryTime' :date="contractEntity.deliveryTime" format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>开始日期</view>
			<view class="right-content">
				<uni-dateformat v-if='contractEntity.startTime' :date="contractEntity.startTime"
					format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>结束日期</view>
			<view class="right-content">
				<uni-dateformat :date="contractEntity.endTime" v-if='contractEntity.endTime'
					format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>审批状态</view>
			<view class="right-content">
				{{contractEntity.status==0?'未审批':(contractEntity.status==1?'审批中':'已审批')}}
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>执行状态</view>
			<view class="right-content" v-if="contractEntity.type==1">
				{{contractEntity.executeStatus==0?'未开始':(contractEntity.executeStatus==1?'执行中':(contractEntity.executeStatus==2?'已发货':(contractEntity.executeStatus==3?'未结算':'已结算')))}}
			</view>
			<view class="right-content" v-if="contractEntity.type==2">
				{{contractEntity.executeStatus==0?'未开始':(contractEntity.executeStatus==1?'执行中':(contractEntity.executeStatus==2?'已到货':'已结算'))}}
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>预付款比例</view>
			<view class="right-content">{{contractEntity.advancePayRatio==null?'--':contractEntity.advancePayRatio+'%'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>预付款时间</view>
			<view class="right-content">
				<uni-dateformat v-if='contractEntity.advancePayTime' :date="contractEntity.advancePayTime" format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>预付款金额</view>
			<view class="right-content">{{contractEntity.advancePayAmount||'--'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>预付款说明</view>
			<view class="right-content">{{contractEntity.advancePayInfo||'--'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>进度款比例</view>
			<view class="right-content">{{contractEntity.progressPayRatio==null?'--':contractEntity.progressPayRatio+'%'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>进度款时间</view>
			<view class="right-content">
				<uni-dateformat v-if="contractEntity.progressPayTime" :date="contractEntity.progressPayTime" format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>进度款金额</view>
			<view class="right-content">{{contractEntity.progressPayAmount||'--'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>进度款说明</view>
			<view class="right-content">{{contractEntity.progressPayInfo||'--'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>{{type==1?'发货款比例':'提货款比例'}}</view>
			<view class="right-content">{{contractEntity.taskSendPayRatio==null?'--':contractEntity.taskSendPayRatio+'%'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>{{type==1?'发货款时间':'提货款时间'}}</view>
			<view class="right-content">
				<uni-dateformat v-if="contractEntity.taskSendPayTime" :date="contractEntity.taskSendPayTime" format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>{{type==1?'发货款金额':'提货款金额'}}</view>
			<view class="right-content">{{contractEntity.taskSendPayAmount||'--'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>{{type==1?'发货款说明':'提货款说明'}}</view>
			<view class="right-content">{{contractEntity.taskSendPayInfo||'--'}}</view>
		</view>
		<view class="regitster-info cell-item" v-if="type==1">
			<view>安装调试款比例</view>
			<view class="right-content">{{contractEntity.installPayRatio==null?'--':contractEntity.installPayRatio+'%'}}</view>
		</view>
		<view class="regitster-info cell-item" v-if="type==1">
			<view>安装调试款时间</view>
			<view class="right-content">
				<uni-dateformat v-if="contractEntity.installPayTime" :date="contractEntity.installPayTime" format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<view class="regitster-info cell-item" v-if="type==1">
			<view>安装调试款金额</view>
			<view class="right-content">{{contractEntity.installPayAmount||'--'}}</view>
		</view>
		<view class="regitster-info cell-item" v-if="type==1">
			<view>安装调试款说明</view>
			<view class="right-content">{{contractEntity.installPayInfo||'--'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>质保金比例</view>
			<view class="right-content">{{contractEntity.retentionMoneyRatio==null?'--':contractEntity.retentionMoneyRatio+'%'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>质保金时间</view>
			<view class="right-content">
				<uni-dateformat v-if="contractEntity.retentionMoneyTime" :date="contractEntity.retentionMoneyTime" format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>质保金金额</view>
			<view class="right-content">{{contractEntity.retentionMoneyAmount||'--'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>质保金说明</view>
			<view class="right-content">{{contractEntity.retentionMoneyInfo||'--'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>{{contractEntity.type==1?'业主':'供应商'}}</view>
			<view class="right-content">{{contractEntity.companyName||'--'}}</view>
		</view>
		<view class="regitster-info cell-item" v-if="type==1">
			<view>设备类别</view>
			<view class="right-content">{{contractEntity.deviceTypeName||'--'}}</view>
		</view>
		<view class="regitster-info cell-item" v-if="type==2">
			<view>项目</view>
			<view class="right-content">{{contractEntity.projectName||'--'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>产品名称</view>
			<view class="right-content">{{contractEntity.productName||'--'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>产品类型</view>
			<view class="right-content">{{contractEntity.productTypeName||'--'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>是否入库</view>
			<view class="right-content">{{contractEntity.isWarehouse==0?'未入库':'已入库'}}</view>
		</view>
		<view class="regitster-info cell-item" v-if="type==2">
			<view>入库时间</view>
			<view class="right-content"><uni-dateformat v-if="contractEntity.inTime" :date="contractEntity.inTime" format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>合同开始时间</view>
			<view class="right-content"><uni-dateformat v-if="contractEntity.startTime" :date="contractEntity.startTime" format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>合同结束时间</view>
			<view class="right-content"><uni-dateformat v-if="contractEntity.endTime" :date="contractEntity.endTime" format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>{{contractEntity.type==1?'是否开具发票':'是否收到发票'}}</view>
			<view class="right-content">{{contractEntity.isInvoice==0?'否':'是'}}</view>
		</view>
		<view class="regitster-info cell-item">
			<view>{{contractEntity.type==1?'发票开具时间':'发票入账时间'}}</view>
			<view class="right-content">
				<uni-dateformat v-if="contractEntity.invoiceEntryTime" :date="contractEntity.invoiceEntryTime" format='yyyy-MM-dd'></uni-dateformat>
				<text v-else>--</text>
			</view>
		</view>
		<view class="regitster-info cell-item">
			<view>发票说明</view>
			<view class="right-content">{{contractEntity.invoiceInfo||'--'}}</view>
		</view>
		<view class="regitster-info cell-item" style="border-bottom: none;">
			<view>备注</view>
			<view class="right-content">{{contractEntity.remark||'--'}}</view>
		</view>
	</view>
</template>

<script>
	import {
		api,
		post
	} from '@/util/api.js'
	export default {
		props: {
			id: '',
			type: 0, // 1销售合同 2采购合同
		},
		data() {
			return {
				contractEntity: {}
			}
		},
		created() {
			this.querySingle()
		},
		methods: {
			querySingle() {
				post(api.ContractSingle, {
					id: this.id
				}).then(res => {
					this.contractEntity = res.data
				})
			}
		}
	}
</script>

<style>
	@import '../../static/css/ContractBaseInfo.css';
</style>